// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include <stdlib.h>

#include <base/command_line.h>
#include <base/logging.h>
#include <chromeos/syslog_logging.h>

#include "tpmd.h"

#ifndef VCSID
#define VCSID "<not set>"
#endif

void start() {
  DBus::BusDispatcher dispatcher;
  DBus::default_dispatcher = &dispatcher;
  DBus::Connection conn = DBus::Connection::SystemBus();
  tpmd::Tpmd tpmd(&conn, &dispatcher);
  if (!tpmd.Init())
    exit(1);
  tpmd.Run();
}

int main(int argc, char *argv[]) {
  CommandLine::Init(argc, argv);
  chromeos::InitLog(chromeos::kLogToSyslog | chromeos::kLogToStderr);
  LOG(INFO) << "tpmd " << VCSID << " starting";
  start();
  return 0;
}
